package com.base.dehong.base;
import com.base.dehong.R;

import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.TextView;


public abstract class FragmentActivityBaseFrame extends FragmentActivity implements OnClickListener,OnItemClickListener{
	
	protected abstract void showProgressDialog();
	
	public abstract void disappearProgressDialog();
	/**
	  * 从控件中获取文本
	  * @param view
	  * @return
	  * 作者： tangwenhan
	  * 时间 ：下午2:59:23
	  */
	 public String getStr4TextView(TextView view){
		 return view.getText().toString().trim();
	 }
	
	public final <E extends View> E getView(int id) {
		try {
			return (E) findViewById(id);
		} catch (ClassCastException ex) {
			Log.e("界面初始化化控件", "类转型异常", ex);
			throw ex;
		}
	}

	public final <E extends View> E getView(View parent, int id) {
		try {
			return (E) parent.findViewById(id);
		} catch (ClassCastException ex) {
			Log.e("通过父类布局初始化化控件", "类转型异常", ex);
			;
			throw ex;
		}
	}
	/**
	 * 注册View的点击事件,然后重写onClick接口函数
	 * @param views
	 */
	public void registerOnClickListener(View...views) {
		for (int i = 0; i < views.length; i++) {
			views[i].setOnClickListener(this);
		}
	}
	public void finish()
	{
		super.finish();
		//Activity退出的效果
		overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out);
	}
	
	@Override
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		
	}
}
